typedef unsigned char *va_list;

#define	va_start( AP, LASTARG )	\
	( AP = ( ( va_list ) & ( LASTARG ) + VA_SIZE( LASTARG ) ) )

#define va_arg( AP, TYPE )						\
 ( AP += __va_rounded_size ( TYPE ),					\
  * ( ( TYPE * ) ( AP - __va_rounded_size ( TYPE ) ) ) )


#define __va_rounded_size( TYPE )  \
  ( ( ( sizeof ( TYPE ) + sizeof ( int ) - 1 ) / sizeof ( int ) ) * sizeof ( int ) )


#define	VA_SIZE( TYPE )					\
	( ( sizeof( TYPE ) + sizeof( STACKITEM ) - 1 )	\
		& ~( sizeof( STACKITEM ) - 1 ) )

#define STACKITEM int

#define va_end(AP)

typedef struct registers_st
{
//	unsigned int gs, fs, es, ds;
	unsigned int ds;
	unsigned int edi, esi, ebp, esp, ebx, edx, ecx, eax;
	unsigned int int_no, err_no;
	unsigned int eip, cs, eflags, useresp, ss;
	unsigned int v86es, v86ds, v86fs, v86gs;
} __attribute__((packed)) registers;

struct vbe_controller_info
{
	unsigned char signature[4];
	unsigned short version;
	unsigned long OEMStringPtr;
	unsigned char Capabilities[4];
	unsigned long VideoModesPtr;
	unsigned short TotalMemory;
	unsigned short OEMSoftwareRev;
	unsigned long OEMVendorNamePtr;
	unsigned long OEMProductNamePtr;
	unsigned long OEMProductRevPtr;
	unsigned char Reserved[222];
	unsigned char OEMData[256];
} __attribute__((packed));

struct vbe_mode_info
{
	unsigned short attributes;
	unsigned char winA, winB;
	unsigned short granularity;
	unsigned short winsize;
	unsigned short segmentA, segmentB;
	unsigned long WinFuncPtr;
	unsigned short pitch;
	
	unsigned short Xres, Yres;
	unsigned char Wchar, Ychar, planes, bpp, banks;
	unsigned char memory_model, bank_size, image_pages;
	unsigned char reserved0;
	
	unsigned char redMask, redPosition;
	unsigned char greenMask, greenPosition;
	unsigned char blueMask, bluePosition;
	unsigned char rsv_mask, rsv_position;
	unsigned char directcolor_attributes;
	
	unsigned long physBase;
	unsigned long reserved1;
	unsigned short reserved2;
} __attribute__((packed));
